package org.jash.mvp2206.user;

import org.jash.mvp2206.entity.CheckCode;
import org.jash.mvp2206.entity.RegisterEntity;
import org.jash.mvp2206.entity.VerifyCode;
import org.jash.mvp2206.mvp.BaseModel;

import java.util.HashMap;

import io.reactivex.rxjava3.core.Observable;

public class RegisterModel extends BaseModel implements Construct.IRegisterModel {
    @Override
    public Observable<VerifyCode> getVerifyCode(String phone) {
        return server.getVerifyCode(phone);
    }

    @Override
    public Observable<CheckCode> checkCode(String phone, String code) {
        return server.checkCode(new HashMap<String, String>() {{
            put("code", code);
            put("phone", phone);
        }});
    }

    @Override
    public Observable<RegisterEntity> register(String username, String password, String phone) {
        return server.register(new HashMap<String, String>() {{
            put("username", username);
            put("password", password);
            put("phone", phone);
        }});
    }
}
